<% gcp_organization_id = "#{external_attribute(pwd, 'gcp_organization_id', doc_generation)}" -%>
<% service_perimeter = grab_attributes(pwd)['service_perimeter'] -%>

policy_name = google_access_context_manager_access_policies(org_id: <%= gcp_organization_id %>).names.first

describe google_access_context_manager_access_level(parent: policy_name, name: "ip_subnet") do
  it { should exist }
  its('title') { should cmp "ip_subnet" }
  its('basic.conditions.size') { should cmp 1 }
  its('basic.conditions.first.ip_subnetworks') { should include "192.0.2.0/24" }
end

describe google_access_context_manager_access_level(parent: policy_name, name: "none") do
  it { should_not exist }
end
